<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link th:href="@{/local/css/page.css}" rel="stylesheet">
    <link th:href="@{/local/css/goodsList.css}" rel="stylesheet">
    <link th:href="@{/css/viewer.css}" rel="stylesheet">
    <link th:href="@{/css/layer.css}" rel="stylesheet">

</head>
<body>
<div id="top" th:include="head.html"></div>
<div id="middle">
    <div id="left" th:include="left.html::left"></div>
    <div id="right">
        <form action="/admin/gotoAddGoods">
            <input type="submit" value="添加商品">
        </form>
        <div id="msg" th:text="${msg}"></div>
        <table id="dataTable">
            <tr>
                <th>商品ID</th>
                <th>商品编号</th>
                <th>商品名称</th>
                <th>商品类别</th>
                <th>商品单价</th>
                <th>库存</th>
                <th>销售量</th>
                <th>添加时间</th>
                <th>热销</th>
                <th>图片</th>
                <th>操作</th>
            </tr>

            <tr th:each="goods:${goodsListPage.list}">
                <td th:text="${goods.getId()}"></td>
                <td  th:text="${goods.getCode()}"></td>
                <td class="width150" >
                    <span th:text="${#strings.abbreviate(goods.getName(),10)}"></span>
                    <input type="hidden" th:value="${goods.getName()}">
                </td>
                <!--                <td th:text="${goods.getCategoryId()}"></td>-->
                <td  th:text="${goods.getCategory().getName()}"></td>

                <td th:text="${goods.getPrice()}"></td>
                <td th:text="${goods.getQuantity()}"></td>
                <td th:text="${goods.getSaleQuantity()}"></td>
                <td th:text="${#dates.format(goods.getAddtime(),'yyyy-mm-dd hh:MM:ss')}"></td>
                <td >
                    <span th:if="${goods.getHot()} eq 1">是</span>
                    <span th:unless="${goods.getHot()} eq 1">否</span>
                </td>
                <td><img class="listimg" th:src="${goods.getImage()}"  >
                </td>
                <td>

                    <a th:href="@{/admin/delGoods/} + ${goods.getId()}">删除</a>
                    <a th:href="@{/admin/goods/} + ${goods.getId()}">编辑</a>
                    <a href="#" th:onclick="delGoods(this, [[${goods.getId()}]] )">删除(ajax)</a>
                </td>
            </tr>
        </table>
        <div th:include="page.html::myPage(${goodsListPage},goodsList)"></div>
    </div>

</div>
<div id="bottom" th:include="bottom.html::bottom"></div>

</body>
<script th:src="@{/js/jquery-3.4.1.slim.min.js}"></script>
<script th:src="@{/js/viewer.js}"></script>
<script th:src="@{/js/jquery-viewer.js}"></script>
<script th:src="@{/js/layer.js}"></script>
<script th:src="@{/js/axios.min.js}"></script>
<script th:src="@{/local/js/goodsList.js}"></script>
<script th:src="@{/js/axios.min.js}"></script>

</html>